(self["webpackChunkant_design_pro"] = self["webpackChunkant_design_pro"] || []).push([["mf-dep_vendors-node_modules_ant-design_pro-utils_es_components_ErrorBoundary_index_js-node_modules_a-26e4c5"],{

/***/ "./node_modules/@ant-design/pro-utils/es/components/ErrorBoundary/index.js":
/*!*********************************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/components/ErrorBoundary/index.js ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var antd_es_result_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/result/style */ "./node_modules/antd/es/result/style/index.js");
/* harmony import */ var antd_es_result__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/result */ "./node_modules/antd/es/result/index.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createSuper */ "./node_modules/@babel/runtime/helpers/esm/createSuper.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");








// eslint-disable-next-line @typescript-eslint/ban-types
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
  (0,_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__.default)(ErrorBoundary, _React$Component);

  var _super = (0,_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_4__.default)(ErrorBoundary);

  function ErrorBoundary() {
    var _this;

    (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__.default)(this, ErrorBoundary);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this.state = {
      hasError: false,
      errorInfo: ''
    };
    return _this;
  }

  (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__.default)(ErrorBoundary, [{
    key: "componentDidCatch",
    value: function componentDidCatch(error, errorInfo) {
      // You can also log the error to an error reporting service
      // eslint-disable-next-line no-console
      console.log(error, errorInfo);
    }
  }, {
    key: "render",
    value: function render() {
      if (this.state.hasError) {
        // You can render any custom fallback UI
        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5__.createElement(antd_es_result__WEBPACK_IMPORTED_MODULE_6__.default, {
          status: "error",
          title: "Something went wrong.",
          extra: this.state.errorInfo
        });
      }

      return this.props.children;
    }
  }], [{
    key: "getDerivedStateFromError",
    value: function getDerivedStateFromError(error) {
      return {
        hasError: true,
        errorInfo: error.message
      };
    }
  }]);

  return ErrorBoundary;
}(react__WEBPACK_IMPORTED_MODULE_5__.Component);

/* harmony default export */ __webpack_exports__["default"] = (ErrorBoundary);

/***/ }),

/***/ "./node_modules/@ant-design/pro-utils/es/components/InlineErrorFormItem/index.js":
/*!***************************************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/components/InlineErrorFormItem/index.js ***!
  \***************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/form/style */ "./node_modules/antd/es/form/style/index.js");
/* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd/es/form */ "./node_modules/antd/es/form/index.js");
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
/* harmony import */ var antd_es_popover_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/popover/style */ "./node_modules/antd/es/popover/style/index.js");
/* harmony import */ var antd_es_popover__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd/es/popover */ "./node_modules/antd/es/popover/index.js");
/* harmony import */ var antd_es_config_provider_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/config-provider/style */ "./node_modules/antd/es/config-provider/style/index.js");
/* harmony import */ var antd_es_config_provider__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd/es/config-provider */ "./node_modules/antd/es/config-provider/index.js");
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./index.less */ "./node_modules/@ant-design/pro-utils/es/components/InlineErrorFormItem/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ant-design/icons */ "./node_modules/@ant-design/icons/es/icons/LoadingOutlined.js");










var _excluded = ["label", "rules", "name", "children", "popoverProps"],
    _excluded2 = ["errorType", "rules", "name", "popoverProps", "children"];



var FIX_INLINE_STYLE = {
  marginTop: -5,
  marginBottom: -5,
  marginLeft: 0,
  marginRight: 0
};

var InlineErrorFormItem = function InlineErrorFormItem(_ref) {
  var inputProps = _ref.inputProps,
      input = _ref.input,
      extra = _ref.extra,
      errorList = _ref.errorList,
      popoverProps = _ref.popoverProps;

  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(false),
      _useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useState, 2),
      visible = _useState2[0],
      setVisible = _useState2[1];

  var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)([]),
      _useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useState3, 2),
      errorStringList = _useState4[0],
      setErrorList = _useState4[1];

  var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_7__.useContext)(antd_es_config_provider__WEBPACK_IMPORTED_MODULE_9__.default.ConfigContext),
      getPrefixCls = _useContext.getPrefixCls;

  (0,react__WEBPACK_IMPORTED_MODULE_7__.useEffect)(function () {
    if (inputProps.validateStatus !== 'validating') {
      setErrorList(inputProps.errors);
    }
  }, [inputProps.errors, inputProps.validateStatus]);
  var prefixCls = getPrefixCls();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(antd_es_popover__WEBPACK_IMPORTED_MODULE_10__.default, {
    key: "popover",
    trigger: (popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.trigger) || 'focus',
    placement: (popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.placement) || 'topRight',
    visible: errorStringList.length < 1 ? false : visible,
    onVisibleChange: function onVisibleChange(visibleParams) {
      if (visibleParams === visible) return;
      setVisible(visibleParams);
    },
    content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("div", {
      className: "".concat(prefixCls, "-form-item-with-help")
    }, inputProps.validateStatus === 'validating' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_11__.default, null) : null, errorList)
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("div", null, input, extra));
};

var InternalFormItem = function InternalFormItem(_ref2) {
  var label = _ref2.label,
      rules = _ref2.rules,
      name = _ref2.name,
      children = _ref2.children,
      popoverProps = _ref2.popoverProps,
      rest = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__.default)(_ref2, _excluded);

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_12__.default.Item, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__.default)({
    preserve: false,
    name: name,
    rules: rules,
    hasFeedback: true // @ts-ignore
    ,
    _internalItemRender: {
      mark: 'pro_table_render',
      render: function render(inputProps, doms) {
        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(InlineErrorFormItem, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__.default)({
          inputProps: inputProps,
          popoverProps: popoverProps
        }, doms));
      }
    }
  }, rest, {
    style: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__.default)({}, FIX_INLINE_STYLE), rest === null || rest === void 0 ? void 0 : rest.style)
  }), children);
};

/* harmony default export */ __webpack_exports__["default"] = (function (props) {
  var errorType = props.errorType,
      rules = props.rules,
      name = props.name,
      popoverProps = props.popoverProps,
      children = props.children,
      rest = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__.default)(props, _excluded2);

  if (name && (rules === null || rules === void 0 ? void 0 : rules.length) && errorType === 'popover') {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(InternalFormItem, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__.default)({
      name: name,
      rules: rules,
      popoverProps: popoverProps
    }, rest), children);
  }

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_12__.default.Item, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__.default)({
    rules: rules
  }, rest, {
    style: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__.default)({}, FIX_INLINE_STYLE), rest.style),
    name: name
  }), children);
});

/***/ }),

/***/ "./node_modules/@ant-design/pro-utils/es/genCopyable/index.js":
/*!********************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/genCopyable/index.js ***!
  \********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "genCopyable": function() { return /* binding */ genCopyable; }
/* harmony export */ });
/* harmony import */ var antd_es_typography_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/typography/style */ "./node_modules/antd/es/typography/style/index.js");
/* harmony import */ var antd_es_typography__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/typography */ "./node_modules/antd/es/typography/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");




var isNeedTranText = function isNeedTranText(item) {
  var _item$valueType;

  if (item === null || item === void 0 ? void 0 : (_item$valueType = item.valueType) === null || _item$valueType === void 0 ? void 0 : _item$valueType.toString().startsWith('date')) {
    return true;
  }

  if ((item === null || item === void 0 ? void 0 : item.valueType) === 'select' || (item === null || item === void 0 ? void 0 : item.valueEnum)) {
    return true;
  }

  return false;
};
/**
 * 生成 Copyable 或 Ellipsis 的 dom
 *
 * @param dom
 * @param item
 * @param text
 */


var genCopyable = function genCopyable(dom, item, text) {
  if (item.copyable || item.ellipsis) {
    var copyable = item.copyable && text ? {
      text: text,
      tooltips: ['', '']
    } : undefined;
    /** 有些 valueType 需要设置copy的为string */

    var needTranText = isNeedTranText(item);
    var ellipsis = item.ellipsis && text ? {
      tooltip: needTranText ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", {
        className: "pro-table-tooltip-text"
      }, dom) : text
    } : false;
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(antd_es_typography__WEBPACK_IMPORTED_MODULE_2__.default.Text, {
      style: {
        width: '100%',
        margin: 0,
        padding: 0
      },
      title: "",
      copyable: copyable,
      ellipsis: ellipsis
    }, dom);
  }

  return dom;
};

/***/ }),

/***/ "./node_modules/@ant-design/pro-utils/es/getFieldPropsOrFormItemProps/index.js":
/*!*************************************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/getFieldPropsOrFormItemProps/index.js ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _runFunction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runFunction */ "./node_modules/@ant-design/pro-utils/es/runFunction/index.js");

/**
 * 因为 fieldProps 支持了 function 所以新增了这个方法
 *
 * @param fieldProps
 * @param form
 */

var getFieldPropsOrFormItemProps = function getFieldPropsOrFormItemProps(fieldProps, form, extraProps) {
  if (form === undefined) {
    return fieldProps;
  }

  return (0,_runFunction__WEBPACK_IMPORTED_MODULE_0__.runFunction)(fieldProps, form, extraProps);
};

/* harmony default export */ __webpack_exports__["default"] = (getFieldPropsOrFormItemProps);

/***/ }),

/***/ "./node_modules/@ant-design/pro-utils/es/useEditableArray/index.js":
/*!*************************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/useEditableArray/index.js ***!
  \*************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "recordKeyToString": function() { return /* binding */ recordKeyToString; },
/* harmony export */   "SaveEditableAction": function() { return /* binding */ SaveEditableAction; },
/* harmony export */   "DeleteEditableAction": function() { return /* binding */ DeleteEditableAction; },
/* harmony export */   "defaultActionRender": function() { return /* binding */ defaultActionRender; }
/* harmony export */ });
/* harmony import */ var antd_es_message_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/message/style */ "./node_modules/antd/es/message/style/index.js");
/* harmony import */ var antd_es_message__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! antd/es/message */ "./node_modules/antd/es/message/index.js");
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var antd_es_popconfirm_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/popconfirm/style */ "./node_modules/antd/es/popconfirm/style/index.js");
/* harmony import */ var antd_es_popconfirm__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! antd/es/popconfirm */ "./node_modules/antd/es/popconfirm/index.js");
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _babel_runtime_helpers_esm_toArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toArray */ "./node_modules/@babel/runtime/helpers/esm/toArray.js");
/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var rc_util_es_hooks_useMergedState__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! rc-util/es/hooks/useMergedState */ "./node_modules/rc-util/es/hooks/useMergedState.js");
/* harmony import */ var antd_es_table_hooks_useLazyKVMap__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! antd/es/table/hooks/useLazyKVMap */ "./node_modules/antd/es/table/hooks/useLazyKVMap.js");
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @ant-design/icons */ "./node_modules/@ant-design/icons/es/icons/LoadingOutlined.js");
/* harmony import */ var _ant_design_pro_provider__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @ant-design/pro-provider */ "./node_modules/@ant-design/pro-provider/es/index.js");
/* harmony import */ var rc_util_es_utils_set__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! rc-util/es/utils/set */ "./node_modules/rc-util/es/utils/set.js");
/* harmony import */ var _useMountMergeState__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../useMountMergeState */ "./node_modules/@ant-design/pro-utils/es/useMountMergeState/index.js");
/* harmony import */ var _components_ProFormContext__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../components/ProFormContext */ "./node_modules/@ant-design/pro-utils/es/components/ProFormContext/index.js");
/* harmony import */ var _merge__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../merge */ "./node_modules/@ant-design/pro-utils/es/merge/index.js");
/* harmony import */ var _hooks_usePrevious__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../hooks/usePrevious */ "./node_modules/@ant-design/pro-utils/es/hooks/usePrevious/index.js");
/* harmony import */ var rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! rc-util/es/utils/get */ "./node_modules/rc-util/es/utils/get.js");
/* harmony import */ var _hooks_useDeepCompareEffect__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../hooks/useDeepCompareEffect */ "./node_modules/@ant-design/pro-utils/es/hooks/useDeepCompareEffect/index.js");
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! .. */ "./node_modules/@ant-design/pro-utils/es/hooks/useRefFunction/index.js");
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! .. */ "./node_modules/@ant-design/pro-utils/es/hooks/useDebounceFn/index.js");














var _excluded = ["map_row_parentKey", "map_row_key"],
    _excluded2 = ["map_row_key"];

/* eslint-disable react-hooks/exhaustive-deps */













var recordKeyToString = function recordKeyToString(rowKey) {
  if (Array.isArray(rowKey)) return rowKey.join(',');
  return rowKey;
};
/**
 * 使用map 来删除数据，性能一般 但是准确率比较高
 *
 * @param params
 * @param action
 */

function editableRowByKey(params, action) {
  var _recordKeyToString;

  var getRowKey = params.getRowKey,
      row = params.row,
      data = params.data,
      childrenColumnName = params.childrenColumnName;
  var key = (_recordKeyToString = recordKeyToString(params.key)) === null || _recordKeyToString === void 0 ? void 0 : _recordKeyToString.toString();
  var kvMap = new Map();
  /**
   * 打平这个数组
   *
   * @param records
   * @param parentKey
   */

  function dig(records, map_row_parentKey, map_row_index) {
    records.forEach(function (record, index) {
      var eachIndex = (map_row_index || 0) * 10 + index;
      var recordKey = getRowKey(record, eachIndex).toString(); // children 取在前面方便拼的时候按照反顺序放回去

      if (record && (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_11__.default)(record) === 'object' && childrenColumnName in record) {
        dig(record[childrenColumnName] || [], recordKey, eachIndex);
      }

      var newRecord = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, record), {}, {
        map_row_key: recordKey,
        children: undefined,
        map_row_parentKey: map_row_parentKey
      });

      delete newRecord.children;

      if (!map_row_parentKey) {
        delete newRecord.map_row_parentKey;
      }

      kvMap.set(recordKey, newRecord);
    });
  }

  if (action === 'top') {
    kvMap.set(key, (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, kvMap.get(key)), row));
  }

  dig(data);

  if (action === 'update') {
    kvMap.set(key, (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, kvMap.get(key)), row));
  }

  if (action === 'delete') {
    kvMap.delete(key);
  }

  var fill = function fill(map) {
    var kvArrayMap = new Map();
    var kvSource = [];
    map.forEach(function (value) {
      if (value.map_row_parentKey) {
        // @ts-ignore
        var map_row_parentKey = value.map_row_parentKey,
            map_row_key = value.map_row_key,
            reset = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_9__.default)(value, _excluded);

        if (kvArrayMap.has(map_row_key)) {
          reset[childrenColumnName] = kvArrayMap.get(map_row_key);
        }

        kvArrayMap.set(map_row_parentKey, [].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_8__.default)(kvArrayMap.get(map_row_parentKey) || []), [reset]));
      }
    });
    map.forEach(function (value) {
      if (!value.map_row_parentKey) {
        // @ts-ignore
        var map_row_key = value.map_row_key,
            rest = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_9__.default)(value, _excluded2);

        if (kvArrayMap.has(map_row_key)) {
          var item = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, rest), {}, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__.default)({}, childrenColumnName, kvArrayMap.get(map_row_key)));

          kvSource.push(item);
          return;
        }

        kvSource.push(rest);
      }
    });
    return kvSource;
  };

  var source = fill(kvMap);
  return source;
}
/**
 * 保存按钮的dom
 *
 * @param ActionRenderConfig
 */


function SaveEditableAction(_ref) {
  var recordKey = _ref.recordKey,
      onSave = _ref.onSave,
      form = _ref.form,
      row = _ref.row,
      children = _ref.children,
      newLineConfig = _ref.newLineConfig,
      editorType = _ref.editorType,
      tableName = _ref.tableName;
  var context = (0,react__WEBPACK_IMPORTED_MODULE_12__.useContext)(_components_ProFormContext__WEBPACK_IMPORTED_MODULE_17__.default);

  var _useMountMergeState = (0,_useMountMergeState__WEBPACK_IMPORTED_MODULE_18__.default)(false),
      _useMountMergeState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useMountMergeState, 2),
      loading = _useMountMergeState2[0],
      setLoading = _useMountMergeState2[1];

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement("a", {
    key: "save",
    onClick: /*#__PURE__*/function () {
      var _ref2 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee(e) {
        var _context$getFieldForm, isMapEditor, namePath, fields, _recordKey, recordKeyPath, curValue, data, res;

        return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                e.stopPropagation();
                e.preventDefault();
                _context.prev = 2;
                isMapEditor = editorType === 'Map'; // 为了兼容类型为 array 的 dataIndex,当 recordKey 是一个数组时，用于获取表单值的 key 只取第一项，
                // 从表单中获取回来之后，再根据 namepath 获取具体的某个字段并设置

                namePath = [tableName, Array.isArray(recordKey) ? recordKey[0] : recordKey].map(function (key) {
                  return key === null || key === void 0 ? void 0 : key.toString();
                }).flat(1).filter(Boolean);
                setLoading(true); // @ts-expect-error

                _context.next = 8;
                return form.validateFields(namePath, {
                  recursive: true
                });

              case 8:
                fields = ((_context$getFieldForm = context.getFieldFormatValue) === null || _context$getFieldForm === void 0 ? void 0 : _context$getFieldForm.call(context, namePath)) || form.getFieldValue(namePath); // 处理 dataIndex 为数组的情况

                if (Array.isArray(recordKey) && recordKey.length > 1) {
                  // 获取 namepath
                  _recordKey = (0,_babel_runtime_helpers_esm_toArray__WEBPACK_IMPORTED_MODULE_4__.default)(recordKey), recordKeyPath = _recordKey.slice(1); // 将目标值获取出来并设置到 fields 当中

                  curValue = (0,rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__.default)(fields, recordKeyPath);
                  (0,rc_util_es_utils_set__WEBPACK_IMPORTED_MODULE_15__.default)(fields, recordKeyPath, curValue);
                }

                data = isMapEditor ? (0,rc_util_es_utils_set__WEBPACK_IMPORTED_MODULE_15__.default)({}, namePath, fields, true) : fields; // 获取数据并保存

                _context.next = 13;
                return onSave === null || onSave === void 0 ? void 0 : onSave(recordKey, // 如果是 map 模式，fields 就是一个值，所以需要set 到对象中
                // 数据模式 fields 是一个对象，所以不需要
                (0,_merge__WEBPACK_IMPORTED_MODULE_19__.merge)({}, row, data), row, newLineConfig);

              case 13:
                res = _context.sent;
                setLoading(false);
                return _context.abrupt("return", res);

              case 18:
                _context.prev = 18;
                _context.t0 = _context["catch"](2);
                // eslint-disable-next-line no-console
                console.log(_context.t0);
                setLoading(false);
                return _context.abrupt("return", null);

              case 23:
              case "end":
                return _context.stop();
            }
          }
        }, _callee, null, [[2, 18]]);
      }));

      return function (_x) {
        return _ref2.apply(this, arguments);
      };
    }()
  }, loading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_20__.default, {
    style: {
      marginRight: 8
    }
  }) : null, children || '保存');
}
/**
 * 删除按钮 dom
 *
 * @param ActionRenderConfig
 */

var DeleteEditableAction = function DeleteEditableAction(_ref3) {
  var recordKey = _ref3.recordKey,
      onDelete = _ref3.onDelete,
      row = _ref3.row,
      children = _ref3.children,
      deletePopconfirmMessage = _ref3.deletePopconfirmMessage,
      cancelEditable = _ref3.cancelEditable;

  var _useMountMergeState3 = (0,_useMountMergeState__WEBPACK_IMPORTED_MODULE_18__.default)(function () {
    return false;
  }),
      _useMountMergeState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useMountMergeState3, 2),
      loading = _useMountMergeState4[0],
      setLoading = _useMountMergeState4[1];

  var onConfirm = /*#__PURE__*/function () {
    var _ref4 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee2() {
      var res;
      return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee2$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              _context2.prev = 0;
              setLoading(true);
              _context2.next = 4;
              return onDelete === null || onDelete === void 0 ? void 0 : onDelete(recordKey, row);

            case 4:
              res = _context2.sent;
              setLoading(false);
              setTimeout(function () {
                cancelEditable(recordKey);
              }, 0);
              return _context2.abrupt("return", res);

            case 10:
              _context2.prev = 10;
              _context2.t0 = _context2["catch"](0);
              // eslint-disable-next-line no-console
              console.log(_context2.t0);
              setLoading(false);
              return _context2.abrupt("return", null);

            case 15:
            case "end":
              return _context2.stop();
          }
        }
      }, _callee2, null, [[0, 10]]);
    }));

    return function onConfirm() {
      return _ref4.apply(this, arguments);
    };
  }();

  return children !== false ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(antd_es_popconfirm__WEBPACK_IMPORTED_MODULE_21__.default, {
    key: "delete",
    title: deletePopconfirmMessage,
    onConfirm: onConfirm
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement("a", null, loading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_20__.default, {
    style: {
      marginRight: 8
    }
  }) : null, children || '删除')) : null;
};

var CancelEditableAction = function CancelEditableAction(props) {
  var recordKey = props.recordKey,
      tableName = props.tableName,
      newLineConfig = props.newLineConfig,
      form = props.form,
      editorType = props.editorType,
      onCancel = props.onCancel,
      cancelEditable = props.cancelEditable,
      row = props.row,
      cancelText = props.cancelText;
  var context = (0,react__WEBPACK_IMPORTED_MODULE_12__.useContext)(_components_ProFormContext__WEBPACK_IMPORTED_MODULE_17__.default);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement("a", {
    key: "cancel",
    onClick: /*#__PURE__*/function () {
      var _ref5 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee3(e) {
        var _context$getFieldForm2;

        var isMapEditor, namePath, fields, record, res;
        return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                e.stopPropagation();
                e.preventDefault();
                isMapEditor = editorType === 'Map';
                namePath = [tableName, recordKey].flat(1).filter(Boolean);
                fields = ((_context$getFieldForm2 = context.getFieldFormatValue) === null || _context$getFieldForm2 === void 0 ? void 0 : _context$getFieldForm2.call(context, namePath)) || form.getFieldValue(namePath);
                record = isMapEditor ? (0,rc_util_es_utils_set__WEBPACK_IMPORTED_MODULE_15__.default)({}, namePath, fields) : fields;
                _context3.next = 8;
                return onCancel === null || onCancel === void 0 ? void 0 : onCancel(recordKey, record, row, newLineConfig);

              case 8:
                res = _context3.sent;
                cancelEditable(recordKey);
                /** 充值为默认值，不然编辑的行会丢掉 */

                form.setFieldsValue((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__.default)({}, recordKey, isMapEditor ? (0,rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__.default)(row, namePath) : row));
                return _context3.abrupt("return", res);

              case 12:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3);
      }));

      return function (_x2) {
        return _ref5.apply(this, arguments);
      };
    }()
  }, cancelText || '取消');
};

function defaultActionRender(row, config) {
  var recordKey = config.recordKey,
      newLineConfig = config.newLineConfig,
      saveText = config.saveText,
      deleteText = config.deleteText;
  return [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(SaveEditableAction, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__.default)({
    key: "save"
  }, config, {
    row: row
  }), saveText), (newLineConfig === null || newLineConfig === void 0 ? void 0 : newLineConfig.options.recordKey) !== recordKey ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(DeleteEditableAction, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__.default)({
    key: "delete"
  }, config, {
    row: row
  }), deleteText) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12__.createElement(CancelEditableAction, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__.default)({
    key: "cancel"
  }, config, {
    row: row
  }))];
}
/**
 * 一个方便的hooks 用于维护编辑的状态
 *
 * @param props
 */

function useEditableArray(props) {
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_12__.useState)(undefined),
      _useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useState, 2),
      newLineRecordCache = _useState2[0],
      setNewLineRecordCache = _useState2[1];

  var dataSourceKeyIndexMapRef = (0,react__WEBPACK_IMPORTED_MODULE_12__.useRef)(new Map());
  var newLineRecordRef = (0,react__WEBPACK_IMPORTED_MODULE_12__.useRef)(undefined);
  (0,_hooks_useDeepCompareEffect__WEBPACK_IMPORTED_MODULE_22__.useDeepCompareEffectDebounce)(function () {
    var _props$dataSource;

    var map = new Map();
    (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.forEach(function (record, index) {
      var _recordKeyToString2;

      map.set(index.toString(), recordKeyToString(props.getRowKey(record, -1)));
      map.set((_recordKeyToString2 = recordKeyToString(props.getRowKey(record, -1))) === null || _recordKeyToString2 === void 0 ? void 0 : _recordKeyToString2.toString(), index.toString());
    });
    dataSourceKeyIndexMapRef.current = map;
  }, [props.dataSource]); // 这里这么做是为了存上次的状态，不然每次存一下再拿

  newLineRecordRef.current = newLineRecordCache;
  var editableType = props.type || 'single';

  var _useLazyKVMap = (0,antd_es_table_hooks_useLazyKVMap__WEBPACK_IMPORTED_MODULE_23__.default)(props.dataSource, 'children', props.getRowKey),
      _useLazyKVMap2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useLazyKVMap, 1),
      getRecordByKey = _useLazyKVMap2[0];

  var _useMergedState = (0,rc_util_es_hooks_useMergedState__WEBPACK_IMPORTED_MODULE_13__.default)([], {
    value: props.editableKeys,
    onChange: props.onChange ? function (keys) {
      var _props$onChange;

      props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, // 计算编辑的key
      keys, // 计算编辑的行
      keys.map(function (key) {
        return getRecordByKey(key);
      }));
    } : undefined
  }),
      _useMergedState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__.default)(_useMergedState, 2),
      editableKeys = _useMergedState2[0],
      setEditableRowKeys = _useMergedState2[1];
  /** 一个用来标志的set 提供了方便的 api 来去重什么的 */


  var editableKeysSet = (0,react__WEBPACK_IMPORTED_MODULE_12__.useMemo)(function () {
    var keys = editableType === 'single' ? editableKeys === null || editableKeys === void 0 ? void 0 : editableKeys.slice(0, 1) : editableKeys;
    return new Set(keys);
  }, [(editableKeys || []).join(','), editableType]);
  var editableKeysRef = (0,_hooks_usePrevious__WEBPACK_IMPORTED_MODULE_24__.default)(editableKeys);
  /** 这行是不是编辑状态 */

  var isEditable = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)(function (row) {
    var _props$getRowKey, _props$getRowKey$toSt, _props$getRowKey2, _props$getRowKey2$toS;

    // 为了兼容一下name 模式的 indexKey，所以需要判断两次，一次是index，一次是没有 index 的
    var recordKeyOrIndex = (_props$getRowKey = props.getRowKey(row, row.index)) === null || _props$getRowKey === void 0 ? void 0 : (_props$getRowKey$toSt = _props$getRowKey.toString) === null || _props$getRowKey$toSt === void 0 ? void 0 : _props$getRowKey$toSt.call(_props$getRowKey); // 这里是不设置 index 的地方

    var recordKey = (_props$getRowKey2 = props.getRowKey(row, -1)) === null || _props$getRowKey2 === void 0 ? void 0 : (_props$getRowKey2$toS = _props$getRowKey2.toString) === null || _props$getRowKey2$toS === void 0 ? void 0 : _props$getRowKey2$toS.call(_props$getRowKey2); // 都转化为了字符串，不然 number 和 string

    var stringEditableKeys = editableKeys.map(function (key) {
      return key.toString();
    });
    var stringEditableKeysRef = (editableKeysRef === null || editableKeysRef === void 0 ? void 0 : editableKeysRef.map(function (key) {
      return key.toString();
    })) || [];
    var preIsEditable = props.tableName && !!(stringEditableKeysRef === null || stringEditableKeysRef === void 0 ? void 0 : stringEditableKeysRef.includes(recordKey)) || !!(stringEditableKeysRef === null || stringEditableKeysRef === void 0 ? void 0 : stringEditableKeysRef.includes(recordKeyOrIndex));
    return {
      recordKey: recordKey,
      isEditable: props.tableName && (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKey)) || (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKeyOrIndex)),
      preIsEditable: preIsEditable
    };
  });
  /**
   * 进入编辑状态
   *
   * @param recordKey
   */

  var startEditable = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)(function (recordKey) {
    // 如果是单行的话，不允许多行编辑
    if (editableKeysSet.size > 0 && editableType === 'single') {
      antd_es_message__WEBPACK_IMPORTED_MODULE_26__.default.warn(props.onlyOneLineEditorAlertMessage || '只能同时编辑一行');

      return false;
    }

    editableKeysSet.add(recordKey);
    setEditableRowKeys(Array.from(editableKeysSet));
    return true;
  });
  /**
   * 退出编辑状态
   *
   * @param recordKey
   */

  var cancelEditable = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)(function (recordKey, needReTry) {
    var relayKey = recordKeyToString(recordKey).toString();
    var key = dataSourceKeyIndexMapRef.current.get(relayKey);
    /** 如果没找到key，转化一下再去找 */

    if (!editableKeysSet.has(relayKey) && key && (needReTry !== null && needReTry !== void 0 ? needReTry : true) && props.tableName) {
      cancelEditable(key, false);
      return;
    }
    /** 如果这个是 new Line 直接删除 */


    if (newLineRecordCache && newLineRecordCache.options.recordKey === recordKey) {
      setNewLineRecordCache(undefined);
    }

    editableKeysSet.delete(relayKey);
    editableKeysSet.delete(recordKeyToString(recordKey));
    setEditableRowKeys(Array.from(editableKeysSet));
    return true;
  });
  var propsOnValuesChange = (0,___WEBPACK_IMPORTED_MODULE_27__.default)( /*#__PURE__*/(0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee4() {
    var _props$onValuesChange;

    var _len,
        rest,
        _key,
        _args4 = arguments;

    return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee4$(_context4) {
      while (1) {
        switch (_context4.prev = _context4.next) {
          case 0:
            for (_len = _args4.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
              rest[_key] = _args4[_key];
            }

            //@ts-ignore
            (_props$onValuesChange = props.onValuesChange) === null || _props$onValuesChange === void 0 ? void 0 : _props$onValuesChange.call.apply(_props$onValuesChange, [props].concat(rest));

          case 2:
          case "end":
            return _context4.stop();
        }
      }
    }, _callee4);
  })), 64);
  var onValuesChange = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)(function (value, values) {
    var _Object$keys$pop;

    if (!props.onValuesChange) {
      return;
    }

    var dataSource = props.dataSource; // 这里是把正在编辑中的所有表单数据都修改掉
    // 不然会用 props 里面的 dataSource，数据只有正在编辑中的
    // Object.keys(get(values, [props.tableName || ''].flat(1)) || values).forEach((recordKey) => {

    editableKeys.forEach(function (eachRecordKey) {
      if ((newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.options.recordKey) === eachRecordKey) return;
      var recordKey = eachRecordKey.toString(); // 如果数据在这个 form 中没有展示，也不显示

      var editRow = (0,rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__.default)(values, [props.tableName || '', recordKey].flat(1).filter(function (key) {
        return key || key === 0;
      }));
      if (!editRow) return;
      dataSource = editableRowByKey({
        data: dataSource,
        getRowKey: props.getRowKey,
        row: editRow,
        key: recordKey,
        childrenColumnName: props.childrenColumnName || 'children'
      }, 'update');
    });
    var relayValue = props.tableName ? (0,rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__.default)(value, [props.tableName || ''].flat(1)) : value;
    var recordKey = (_Object$keys$pop = Object.keys(relayValue || {}).pop()) === null || _Object$keys$pop === void 0 ? void 0 : _Object$keys$pop.toString(); //从form 和 cache 中取得数据

    var newLineRecordData = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.defaultValue), (0,rc_util_es_utils_get__WEBPACK_IMPORTED_MODULE_16__.default)(values, [props.tableName || '', recordKey.toString()].flat(1).filter(function (key) {
      return key || key === 0;
    })));
    /** 如果已经在 dataSource 中存在了，直接 find */


    var editRow = dataSourceKeyIndexMapRef.current.has(recordKeyToString(recordKey)) ? dataSource.find(function (item, index) {
      var _props$getRowKey3;

      var key = (_props$getRowKey3 = props.getRowKey(item, index)) === null || _props$getRowKey3 === void 0 ? void 0 : _props$getRowKey3.toString();
      return key === recordKey;
    }) : newLineRecordData;
    propsOnValuesChange.run(editRow || newLineRecordData, dataSource);
  });
  /**
   * 同时只能支持一行,取消之后数据消息，不会触发 dataSource
   *
   * @param row
   * @param options
   * @name 增加新的行
   */

  var addEditRecord = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)(function (row, options) {
    // 暂时不支持多行新增
    if (newLineRecordRef.current) {
      antd_es_message__WEBPACK_IMPORTED_MODULE_26__.default.warn(props.onlyAddOneLineAlertMessage || '只能新增一行');

      return false;
    } // 如果是单行的话，不允许多行编辑


    if (editableKeysSet.size > 0 && editableType === 'single') {
      antd_es_message__WEBPACK_IMPORTED_MODULE_26__.default.warn(props.onlyOneLineEditorAlertMessage || '只能同时编辑一行');

      return false;
    } // 防止多次渲染


    var recordKey = props.getRowKey(row, props.dataSource.length);
    editableKeysSet.add(recordKey);
    setEditableRowKeys(Array.from(editableKeysSet)); // 如果是dataSource 新增模式的话，取消再开始编辑，
    // 这样就可以把新增到 dataSource的数据进入编辑模式了
    // [a,b,cache] => [a,b,c]

    if ((options === null || options === void 0 ? void 0 : options.newRecordType) === 'dataSource') {
      var _recordKeyToString3;

      var actionProps = {
        data: props.dataSource,
        getRowKey: props.getRowKey,
        row: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, row), {}, {
          map_row_parentKey: (options === null || options === void 0 ? void 0 : options.parentKey) ? (_recordKeyToString3 = recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey)) === null || _recordKeyToString3 === void 0 ? void 0 : _recordKeyToString3.toString() : undefined
        }),
        key: recordKey,
        childrenColumnName: props.childrenColumnName || 'children'
      };
      props.setDataSource(editableRowByKey(actionProps, (options === null || options === void 0 ? void 0 : options.position) === 'top' ? 'top' : 'update'));
    } else {
      setNewLineRecordCache({
        defaultValue: row,
        options: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_10__.default)({}, options), {}, {
          recordKey: recordKey
        })
      });
    }

    return true;
  }); // Internationalization

  var intl = (0,_ant_design_pro_provider__WEBPACK_IMPORTED_MODULE_14__.useIntl)();
  var saveText = (props === null || props === void 0 ? void 0 : props.saveText) || intl.getMessage('editableTable.action.save', '保存');
  var deleteText = (props === null || props === void 0 ? void 0 : props.deleteText) || intl.getMessage('editableTable.action.delete', '删除');
  var cancelText = (props === null || props === void 0 ? void 0 : props.cancelText) || intl.getMessage('editableTable.action.cancel', '取消');
  var actionSaveRef = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)( /*#__PURE__*/function () {
    var _ref7 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee5(recordKey, editRow, originRow, newLine) {
      var _props$onSave;

      var _ref8, options, res, actionProps;

      return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee5$(_context5) {
        while (1) {
          switch (_context5.prev = _context5.next) {
            case 0:
              _ref8 = newLine || {}, options = _ref8.options;
              _context5.next = 3;
              return props === null || props === void 0 ? void 0 : (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, recordKey, editRow, originRow, newLine);

            case 3:
              res = _context5.sent;
              // 保存时解除编辑模式
              cancelEditable(recordKey);

              if (!(newLine && (options === null || options === void 0 ? void 0 : options.recordKey) === recordKey)) {
                _context5.next = 8;
                break;
              }

              if ((options === null || options === void 0 ? void 0 : options.position) === 'top') {
                props.setDataSource([editRow].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_8__.default)(props.dataSource)));
              } else {
                props.setDataSource([].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_8__.default)(props.dataSource), [editRow]));
              }

              return _context5.abrupt("return", res);

            case 8:
              actionProps = {
                data: props.dataSource,
                getRowKey: props.getRowKey,
                row: editRow,
                key: recordKey,
                childrenColumnName: props.childrenColumnName || 'children'
              };
              props.setDataSource(editableRowByKey(actionProps, 'update'));
              return _context5.abrupt("return", res);

            case 11:
            case "end":
              return _context5.stop();
          }
        }
      }, _callee5);
    }));

    return function (_x3, _x4, _x5, _x6) {
      return _ref7.apply(this, arguments);
    };
  }());
  var actionDeleteRef = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)( /*#__PURE__*/function () {
    var _ref9 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee6(recordKey, editRow) {
      var _props$onDelete;

      var actionProps, res;
      return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee6$(_context6) {
        while (1) {
          switch (_context6.prev = _context6.next) {
            case 0:
              actionProps = {
                data: props.dataSource,
                getRowKey: props.getRowKey,
                row: editRow,
                key: recordKey,
                childrenColumnName: props.childrenColumnName || 'children'
              };
              _context6.next = 3;
              return props === null || props === void 0 ? void 0 : (_props$onDelete = props.onDelete) === null || _props$onDelete === void 0 ? void 0 : _props$onDelete.call(props, recordKey, editRow);

            case 3:
              res = _context6.sent;
              props.setDataSource(editableRowByKey(actionProps, 'delete'));
              return _context6.abrupt("return", res);

            case 6:
            case "end":
              return _context6.stop();
          }
        }
      }, _callee6);
    }));

    return function (_x7, _x8) {
      return _ref9.apply(this, arguments);
    };
  }());
  var actionCancelRef = (0,___WEBPACK_IMPORTED_MODULE_25__.useRefFunction)( /*#__PURE__*/function () {
    var _ref10 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_5__.default)( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().mark(function _callee7(recordKey, editRow, originRow, newLine) {
      var _props$onCancel;

      var res;
      return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default().wrap(function _callee7$(_context7) {
        while (1) {
          switch (_context7.prev = _context7.next) {
            case 0:
              _context7.next = 2;
              return props === null || props === void 0 ? void 0 : (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, recordKey, editRow, originRow, newLine);

            case 2:
              res = _context7.sent;
              return _context7.abrupt("return", res);

            case 4:
            case "end":
              return _context7.stop();
          }
        }
      }, _callee7);
    }));

    return function (_x9, _x10, _x11, _x12) {
      return _ref10.apply(this, arguments);
    };
  }());

  var actionRender = function actionRender(row, form) {
    var key = props.getRowKey(row, row.index);
    var config = {
      saveText: saveText,
      cancelText: cancelText,
      deleteText: deleteText,
      addEditRecord: addEditRecord,
      recordKey: key,
      cancelEditable: cancelEditable,
      index: row.index,
      tableName: props.tableName,
      newLineConfig: newLineRecordCache,
      onCancel: actionCancelRef,
      onDelete: actionDeleteRef,
      onSave: actionSaveRef,
      form: form,
      editableKeys: editableKeys,
      setEditableRowKeys: setEditableRowKeys,
      deletePopconfirmMessage: props.deletePopconfirmMessage || '删除此行？'
    };
    var defaultDoms = defaultActionRender(row, config);
    if (props.actionRender) return props.actionRender(row, config, {
      save: defaultDoms[0],
      delete: defaultDoms[1],
      cancel: defaultDoms[2]
    });
    return defaultDoms;
  };

  return {
    editableKeys: editableKeys,
    setEditableRowKeys: setEditableRowKeys,
    isEditable: isEditable,
    actionRender: actionRender,
    startEditable: startEditable,
    cancelEditable: cancelEditable,
    addEditRecord: addEditRecord,
    newLineRecord: newLineRecordCache,
    preEditableKeys: editableKeysRef,
    onValuesChange: onValuesChange
  };
}

/* harmony default export */ __webpack_exports__["default"] = (useEditableArray);

/***/ }),

/***/ "./node_modules/@ant-design/pro-utils/es/components/InlineErrorFormItem/index.less":
/*!*****************************************************************************************!*\
  !*** ./node_modules/@ant-design/pro-utils/es/components/InlineErrorFormItem/index.less ***!
  \*****************************************************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/card/style/index.less":
/*!****************************************************!*\
  !*** ./node_modules/antd/es/card/style/index.less ***!
  \****************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/message/style/index.less":
/*!*******************************************************!*\
  !*** ./node_modules/antd/es/message/style/index.less ***!
  \*******************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/popconfirm/style/index.less":
/*!**********************************************************!*\
  !*** ./node_modules/antd/es/popconfirm/style/index.less ***!
  \**********************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/result/style/index.less":
/*!******************************************************!*\
  !*** ./node_modules/antd/es/result/style/index.less ***!
  \******************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/tabs/style/index.less":
/*!****************************************************!*\
  !*** ./node_modules/antd/es/tabs/style/index.less ***!
  \****************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/typography/style/index.less":
/*!**********************************************************!*\
  !*** ./node_modules/antd/es/typography/style/index.less ***!
  \**********************************************************/
/***/ (function() {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ }),

/***/ "./node_modules/antd/es/card/style/index.js":
/*!**************************************************!*\
  !*** ./node_modules/antd/es/card/style/index.js ***!
  \**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/card/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _tabs_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../tabs/style */ "./node_modules/antd/es/tabs/style/index.js");
/* harmony import */ var _row_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../row/style */ "./node_modules/antd/es/row/style/index.js");
/* harmony import */ var _col_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../col/style */ "./node_modules/antd/es/col/style/index.js");

 // style dependencies





/***/ }),

/***/ "./node_modules/antd/es/message/style/index.js":
/*!*****************************************************!*\
  !*** ./node_modules/antd/es/message/style/index.js ***!
  \*****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/message/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);



/***/ }),

/***/ "./node_modules/antd/es/popconfirm/style/index.js":
/*!********************************************************!*\
  !*** ./node_modules/antd/es/popconfirm/style/index.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _popover_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../popover/style */ "./node_modules/antd/es/popover/style/index.js");
/* harmony import */ var _button_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../button/style */ "./node_modules/antd/es/button/style/index.js");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/popconfirm/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_3__);
 // style dependencies
// deps-lint-skip: tooltip, popover





/***/ }),

/***/ "./node_modules/antd/es/result/style/index.js":
/*!****************************************************!*\
  !*** ./node_modules/antd/es/result/style/index.js ***!
  \****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/result/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);



/***/ }),

/***/ "./node_modules/antd/es/tabs/style/index.js":
/*!**************************************************!*\
  !*** ./node_modules/antd/es/tabs/style/index.js ***!
  \**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/tabs/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);



/***/ }),

/***/ "./node_modules/antd/es/typography/style/index.js":
/*!********************************************************!*\
  !*** ./node_modules/antd/es/typography/style/index.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/default.less */ "./node_modules/antd/es/style/default.less");
/* harmony import */ var _style_default_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_default_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ "./node_modules/antd/es/typography/style/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _tooltip_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../tooltip/style */ "./node_modules/antd/es/tooltip/style/index.js");
/* harmony import */ var _input_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../input/style */ "./node_modules/antd/es/input/style/index.js");

 // style dependencies




/***/ }),

/***/ "./node_modules/use-media-antd-query/es/index.js":
/*!*******************************************************!*\
  !*** ./node_modules/use-media-antd-query/es/index.js ***!
  \*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "MediaQueryEnum": function() { return /* binding */ MediaQueryEnum; },
/* harmony export */   "getScreenClassName": function() { return /* binding */ getScreenClassName; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var _useMediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useMediaQuery */ "./node_modules/use-media-antd-query/es/useMediaQuery.js");
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }



var MediaQueryEnum = {
  xs: {
    maxWidth: 575,
    matchMedia: '(max-width: 575px)'
  },
  sm: {
    minWidth: 576,
    maxWidth: 767,
    matchMedia: '(min-width: 576px) and (max-width: 767px)'
  },
  md: {
    minWidth: 768,
    maxWidth: 991,
    matchMedia: '(min-width: 768px) and (max-width: 991px)'
  },
  lg: {
    minWidth: 992,
    maxWidth: 1199,
    matchMedia: '(min-width: 992px) and (max-width: 1199px)'
  },
  xl: {
    minWidth: 1200,
    maxWidth: 1599,
    matchMedia: '(min-width: 1200px) and (max-width: 1599px)'
  },
  xxl: {
    minWidth: 1600,
    matchMedia: '(min-width: 1600px)'
  }
};
/**
 * loop query screen className
 * Array.find will throw a error
 * `Rendered more hooks than during the previous render.`
 * So should use Array.forEach
 */

var getScreenClassName = function getScreenClassName() {
  var className = 'md'; // support ssr

  if (typeof window === 'undefined') {
    return className;
  }

  var mediaQueryKey = Object.keys(MediaQueryEnum).find(function (key) {
    var matchMedia = MediaQueryEnum[key].matchMedia;

    if (window.matchMedia(matchMedia).matches) {
      return true;
    }

    return false;
  });
  className = mediaQueryKey;
  return className;
};

var useMedia = function useMedia() {
  var isMd = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.md.matchMedia);
  var isLg = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.lg.matchMedia);
  var isXxl = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.xxl.matchMedia);
  var isXl = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.xl.matchMedia);
  var isSm = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.sm.matchMedia);
  var isXs = (0,_useMediaQuery__WEBPACK_IMPORTED_MODULE_1__.default)(MediaQueryEnum.xs.matchMedia);

  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(getScreenClassName()),
      _useState2 = _slicedToArray(_useState, 2),
      colSpan = _useState2[0],
      setColSpan = _useState2[1];

  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
    if (false) {}

    if (isXxl) {
      setColSpan('xxl');
      return;
    }

    if (isXl) {
      setColSpan('xl');
      return;
    }

    if (isLg) {
      setColSpan('lg');
      return;
    }

    if (isMd) {
      setColSpan('md');
      return;
    }

    if (isSm) {
      setColSpan('sm');
      return;
    }

    if (isXs) {
      setColSpan('xs');
      return;
    }

    setColSpan('md');
  }, [isMd, isLg, isXxl, isXl, isSm, isXs]);
  return colSpan;
};

/* harmony default export */ __webpack_exports__["default"] = (useMedia);

/***/ }),

/***/ "./node_modules/use-media-antd-query/es/useMediaQuery.js":
/*!***************************************************************!*\
  !*** ./node_modules/use-media-antd-query/es/useMediaQuery.js ***!
  \***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ useMediaQuery; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }


function useMediaQuery(mediaQuery) {
  var isSsr = typeof window === 'undefined';

  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(function () {
    return isSsr ? false : window.matchMedia(mediaQuery).matches;
  }),
      _useState2 = _slicedToArray(_useState, 2),
      matches = _useState2[0],
      setMatches = _useState2[1];

  (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(function () {
    if (isSsr) {
      return;
    }

    var mediaQueryList = window.matchMedia(mediaQuery);

    var listener = function listener(e) {
      return setMatches(e.matches);
    };

    mediaQueryList.addListener(listener);
    return function () {
      return mediaQueryList.removeListener(listener);
    };
  }, [mediaQuery]);
  return matches;
}

/***/ })

}]);